package com.yyyzzz.servlet;

import com.yyyzzz.service.courseService;
import com.yyyzzz.service.impl.courseServiceimpl;
import com.yyyzzz.service.impl.studentServiceimpl;
import com.yyyzzz.service.studentService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/deleteStuCourseServlet")
public class deleteStuCourseServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        response.setContentType("text/html;charset=utf-8");
        String courseid = request.getParameter("courseid");

        response.setCharacterEncoding("utf-8");
        studentService service = new studentServiceimpl();
        int success = service.deleteByStuCourseid(courseid);
        if(success==1) {
            request.getRequestDispatcher("studentMain.jsp").forward(request, response);
        }
    }
}
